from selenium import webdriver

url = "https://www.huya.com/g/lol"
driver = webdriver.Chrome()
driver.get(url)
num = 1
while True:
    print(f"第{str(num)}页")
    num += 1
    html = driver.page_source
    names = driver.find_elements_by_xpath("//i[@class='nick']")
    counts = driver.find_elements_by_xpath("//i[@class='js-num']")
    # for name, count in zip(names, counts):
    #     print(f"{name.text}:{count.text}")
    if driver.page_source.find("laypage_next") != -1:
        driver.find_element_by_xpath("//a[@class='laypage_next']").click()
    else:
        break
